/*
 * Copyright (c) 2020, Armink, <armink.ztl@gmail.com>
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#ifndef _FAL_CFG_H_
#define _FAL_CFG_H_

// #define FAL_DEBUG 1
// #define FAL_PART_HAS_TABLE_CFG
#define FAL_DEBUG 1
#define FAL_PART_HAS_TABLE_CFG
// #define FAL_USING_SFUD_PORT

/* ===================== Flash device Configuration ========================= */
#ifdef FAL_USING_SFUD_PORT
extern struct fal_flash_dev nor_flash0;
/* flash device table */
#define FAL_FLASH_DEV_TABLE   \
{                             \
    &nor_flash0,              \
}
#else
// extern const struct fal_flash_dev cmakeFlash;
extern struct fal_flash_dev cmakeFlash;
/* flash device table */
#define FAL_FLASH_DEV_TABLE   \
{                             \
    &cmakeFlash,              \
}
#endif  /* FAL_USING_SFUD_PORT */
#define     EF_START_ADDR       (0)
#define     TSDB1_AREA_SIZE     (8*1024)
#define     ENV_AREA_SIZE       (8*1024)
#define     LOG_AREA_SIZE       (0)
#define     FDB_TOTAL_SIZE      (TSDB1_AREA_SIZE + ENV_AREA_SIZE + LOG_AREA_SIZE)
/* ====================== Partition Configuration ========================== */
#ifdef FAL_PART_HAS_TABLE_CFG
/* partition table */
#ifdef FAL_USING_SFUD_PORT
#define FAL_PART_TABLE                                                      \
{                                                                           \
{FAL_PART_MAGIC_WORD,"tsdb1","norflash0",  0           , 496*1024, 0},  \
{FAL_PART_MAGIC_WORD,"kvdb1","norflash0", (496*1024), 8*1024 , 0},  \
}
#else
#define FAL_PART_TABLE                                                      \
{                                                                           \
{FAL_PART_MAGIC_WORD,"tsdb1","cmakeFlash",  0                                , TSDB1_AREA_SIZE, 0},  \
{FAL_PART_MAGIC_WORD,"kvdb1","cmakeFlash", EF_START_ADDR+TSDB1_AREA_SIZE     , ENV_AREA_SIZE , 0},  \
}
#endif  /* FAL_USING_SFUD_PORT */
#endif /* FAL_PART_HAS_TABLE_CFG */

#endif /* _FAL_CFG_H_ */
